Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuke-icon

Package Overview
Dependencies
Maintainers
4
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-icon

图标

  • 0.3.9
  • npm
  • Socket score

Version published
Weekly downloads
33
increased by26.92%
Maintainers
4
Weekly downloads
 
Created
Source

Icon

  • category: UI
  • chinese: 图标
  • type: UI组件

Nuke UI

nuke-icon@ALINPM nuke-icon@ALINPM

设计思路

Icon 组件 是对 Image 组件的一个封装,预置了4个尺寸的图片,方便我们在开发中使用方形的图片。

考虑到使用便捷性,还额外加入了 Iconfont 图标的支持,内置的 icon 库是:iconfont.cn 上的千牛官方库,所有支持的 icon 以及对应的 name 值,可以扫码看 demo 。

API

参数说明类型默认值
size当传入name时失效,定义了icon的尺寸:'xs', 'small', 'medium', 'large'string'medium'
onPress当传入name时失效,Press事件Function
src当传入name时失效图片链接地址,注意图片必须为方图string
nameiconfont name值string
version如果使用新版千牛官方图标,则需传入v2stringdefault

demo 参考

扫码预览(手淘、千牛、天猫等)

使用方法

  • 安装
// 切换到你的 rax 项目中
tnpm i nuke-icon --save
// 参考如下 demo 您可能还需要安装
// tnpm i nuke-view nuke-text nuke-layout nuke-page --save
  • 调用示例
/** @jsx createElement */
import {createElement, Component,render } from 'rax';
import View from 'nuke-view';
import Text from 'nuke-text';
import Icon from 'nuke-icon';
import { MultiRow } from 'nuke-layout';
import Page from 'nuke-page';
const ICONS = {
    v2:["accessory","activity","activity_fill","add","addition_fill","addition","addpeople_fill","addpeople","addressbook_fill","addressbook","barrage_fill","barrage","browse_fill","browse","brush","brush_fill","businesscard_fill","businesscard","camera_fill","camera","clock_fill","clock","close","collection_fill","collection","computer_fill","computer","coordinates_fill","coordinates","coupons_fill","coupons","createtask_fill","createtask","customerservice_fill","customerservice","delete_fill","delete","document","document_fill","dynamic_fill","dynamic","editor","eit","emoji_fill","emoji","empty","empty_fill","enter","enterinto","enterinto_fill","feedback_fill","feedback","flag_fill","flag","flashlight","flashlight_fill","flip","flip_fill","fullscreen","group","group_fill","headlines_fill","headlines","homepage_fill","homepage","integral_fill","integral","interactive_fill","interactive","keyboard","label","label_fill","like_fill","like","live_fill","live","lock_fill","lock","mail","mail_fill","manage_fill","manage","message","message_fill","mine","mine_fill","mobilephone_fill","mobilephone","more","narrow","offline_fill","offline","order_fill","order","other","people_fill","people","picture_fill","picture","play","play_fill","playon_fill","playon","praise_fill","praise","prompt_fill","prompt","qrcode_fill","qrcode","redpacket_fill","redpacket","refresh","remind_fill","remind","return","right","scan","select_fill","select","send","service_fill","service","setup_fill","setup","share_fill","share","shielding_fill","shielding","smallscreen_fill","smallscreen","stealth_fill","stealth","success_fill","success","suspend","switch","systemprompt_fill","systemprompt","tailor","task","task_fill","tasklist_fill","tasklist","text","time_fill","time","translation_fill","translation","trash","trash_fill","undo","unlock_fill","unlock","video","video_fill","warning_fill","warning","workbench_fill","workbench","search","searchfill","qianniu","publishgoods_fill","shop_fill","transaction_fill","packup","unfold","wangwang","financial_fill","marketing_fill","shake","decoration_fill","decoration_fill","decoration_fill"]
}
let App = class NukeDemoIndex extends Component {
    constructor() {
        super();
        
    }
    renderGridCellV2 = (item,index) => {
        return <View style={styles.iconCell}>
                <Icon version="v2" style={[styles.icon,styles.new]} name={item} />
                <Text style={styles.iconShowCode}>{item}</Text>
            </View>
    }

    render() {
        return (
            <Page title="Icon">
                <Page.Intro main="全新的 icons 集合(v2)"></Page.Intro>
                <View style={styles.lineWithMargin}><MultiRow dataSource={ICONS['v2']} rows={3} renderRow={this.renderGridCellV2} /></View>
            </Page>

        );
    }
}
const styles={
    icon:{
        fontSize:40,
        marginBottom:20,
        marginRight:'10rem'
    },
    iconCell:{
        justifyContent:'center',
        height:'180rem',
        alignItems:'center',
        borderWidth:'1rem',
        borderColor:'#eeeeee',
        borderStyle:'solid',
    },
    new:{
        fontSize:68,

        color:'#3089dc'
    },
    listLine:{
        marginLeft:'40rem',
        marginRight:'40rem',
        padding:'20rem',
        flexDirection:'row',
        backgroundColor:'#ffffff'

    },
    lineWithMargin:{
        marginLeft:'40rem',
        marginRight:'40rem',
        backgroundColor:'#ffffff'

    },
    
    iconShowCode:{
        fontSize: 24,
        color:'#999999',
    }
}
render(<App/>);

其他

  • bug、建议联系 @翊晨
  • 钉钉交流群

Keywords

FAQs

Package last updated on 02 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc